<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNationGridLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('nation_grid_log', function (Blueprint $table) {
            $table->increments('id');//自增id
            $table->integer('user_id')->comment('用户id');
            $table->unsignedInteger('ticket_num')->default(0)->comment('抽奖卷总数量');
            $table->unsignedInteger('consumer_num')->default(0)->comment('消耗卷数量');
            $table->tinyInteger('log_one')->default(0)->comment('0未领取');
            $table->tinyInteger('log_two')->default(0)->comment('0未领取');
            $table->tinyInteger('log_three')->default(0)->comment('0未领取');
            $table->timestamp('created_at')->default(\Illuminate\Support\Facades\DB::raw("CURRENT_TIMESTAMP"))->comment('创建时间');
            $table->unique(['user_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('nation_grid_log');
    }
}
